import VueRouter from 'vue-router'
export default {
    install(Vue) {
        //重写接口,确保多次编程导航不会报错
        function rewriteRouterAPI(type) {
            var origin = VueRouter.prototype[type];
            return function (options, resolve = () => {}, reject = () => {}) {
                origin.call(this, options, resolve, reject)
            }
        }
        VueRouter.prototype.push = rewriteRouterAPI('push')
        VueRouter.prototype.replace = rewriteRouterAPI('replace')
    }
}
